/* 编辑器样式 */

/* 基础样式重置 */
.editor-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
    color: var(--text-primary);
    transition: var(--transition);
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 140px;
    padding: 4px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    margin-top: 5px;
    z-index: 9999;
}

/* 添加下拉菜单的小三角形 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid white;
    z-index: 10000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #24292e;
}

.dropdown-item:hover {
    background-color: #f6f8fa;
}

.dropdown-item svg {
    margin-right: 8px;
}

/* 深色主题下的下拉菜单样式 */
body.dark-theme .dropdown-menu {
    background-color: #2d2d2d;
    border: 1px solid #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 深色主题下的下拉菜单三角形 */
body.dark-theme .dropdown-menu::before {
    border-bottom-color: #2d2d2d;
}

body.dark-theme .dropdown-item {
    color: #e1e4e8;
}

body.dark-theme .dropdown-item:hover {
    background-color: #3d3d3d;
}

/* 顶部工具栏 */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    color: white;
    border-bottom: none;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    z-index: 100; /* 较高的层级，确保在内容区域之上 */
}

.editor-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 90% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    z-index: 0;
}

.editor-header > * {
    position: relative;
    z-index: 1;
}

.header-left h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ffffff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 按钮样式 */
.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    white-space: nowrap;
}

.theme-btn:hover, .action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 面板操作按钮样式 */
.panel-actions .action-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(79, 70, 229, 0.2);
    backdrop-filter: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-actions .action-btn:hover {
    background: rgba(79, 70, 229, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 深色主题下面板操作按钮 */
body.dark-theme .panel-actions .action-btn {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* 主题按钮样式 */
.theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    white-space: nowrap;
}

/* 主题选项样式 */
.theme-option {
    gap: 10px;
}

.theme-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.theme-default-preview {
    background: linear-gradient(135deg, #667eea 50%, #f5f7fa 50%);
}

.theme-dark-preview {
    background: linear-gradient(135deg, #8884d8 50%, #2c3e50 50%);
}

.theme-forest-preview {
    background: linear-gradient(135deg, #4caf50 50%, #f1f8e9 50%);
}

.theme-industrial-preview {
    background: linear-gradient(135deg, #7d8c4b 50%, #f5f5f5 50%);
}

.theme-cyberpunk-preview {
    background: linear-gradient(135deg, #ff0055 50%, #000000 50%);
}

.theme-minimalist-preview {
    background: linear-gradient(135deg, #404040 50%, #ffffff 50%);
}

.theme-greenit-preview {
    background: linear-gradient(135deg, #2e7d32 50%, #f1f8e9 50%);
}

.dropdown-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

/* 深色主题下的分隔线 */
body.dark-theme .dropdown-divider {
    background-color: #444;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #fafbfc 0%, #f6f8fa 100%);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.close-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: scale(1.1);
}

.modal-body {
    padding: 0;
}

.theme-customization {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.theme-control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-control-group label {
    min-width: 100px;
    font-weight: 500;
    color: var(--text-primary);
}

.color-input {
    width: 50px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.color-input:hover, .color-input:focus {
    border-color: var(--primary-color);
}

.color-text {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    outline: none;
    transition: border-color 0.2s;
}

.color-text:hover, .color-text:focus {
    border-color: var(--primary-color);
}/* 背景设置相关样式已更新到新位置 */

/* 深色模式适配 */
.dark-theme .pattern-dots {
    background-image: radial-gradient(circle, #555 1px, transparent 1px);
}

.dark-theme .pattern-lines {
    background-image: repeating-linear-gradient(45deg, #555 0, #555 1px, transparent 1px, transparent 8px);
}

.dark-theme .pattern-grid {
    background-image: 
        linear-gradient(to right, #555 1px, transparent 1px),
        linear-gradient(to bottom, #555 1px, transparent 1px);
}

/* 主题预览相关样式 */
.theme-preview-container {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.theme-preview-container h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.theme-preview-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 6px;
    position: relative;
    min-height: 60px;
}

.preview-node {
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-connector {
    width: 40px;
    height: 2px;
    background-color: #667eea;
    position: relative;
}

.preview-connector::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #667eea;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 24px 28px;
    border-top: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #fafbfc 0%, #f6f8fa 100%);
    border-radius: 0 0 16px 16px;
}

/* 图表提示文档模态框样式 - 简约版 */
.chart-docs-modal-content {
    max-width: 600px;
    width: 90%;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chart-docs-body {
    padding: 0;
}

.chart-docs-container {
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
    scrollbar-width: thin; /* Firefox: 使用细滚动条 */
    scrollbar-color: transparent transparent; /* Firefox: 默认透明滚动条 */
}

/* 当鼠标悬停时显示滚动条 */
.chart-docs-container:hover {
    scrollbar-color: var(--primary-color) transparent; /* Firefox: 悬停时显示滚动条 */
}

/* Chrome, Safari, Edge: 默认隐藏滚动条 */
.chart-docs-container::-webkit-scrollbar {
    width: 6px;
}

.chart-docs-container::-webkit-scrollbar-track {
    background: transparent;
}

.chart-docs-container::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

/* 当鼠标悬停时显示滚动条 */
.chart-docs-container:hover::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

.chart-docs-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5;
}

.chart-docs-header h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-docs-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.chart-docs-section {
    margin-bottom: 20px;
}

.docs-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 10px 0;
}

.syntax-content pre {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
}

.parameters-content {
    font-size: 14px;
    line-height: 1.5;
}

.parameters-content ul {
    margin: 0;
    padding-left: 20px;
}

.parameters-content li {
    margin-bottom: 6px;
}

.parameters-content strong {
    color: var(--text-primary);
}

.example-content pre {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
}

.tips-content {
    font-size: 14px;
    line-height: 1.5;
}

.tips-content ul {
    margin: 0;
    padding-left: 20px;
}

.tips-content li {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.copy-example-btn.success {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.tips-content {
    display: grid;
    gap: 8px;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #dbeafe;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

.tip-icon {
    color: #3b82f6;
    font-size: 16px;
    margin-top: 2px;
}

.tip-text {
    color: #1e40af;
    font-size: 14px;
    line-height: 1.5;
}

/* 深色模式下的自定义滚动条 */
.dark-theme .chart-docs-container::-webkit-scrollbar-track {
    background: #374151;
}

.dark-theme .chart-docs-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

.dark-theme .chart-docs-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 当内容不超过最大高度时隐藏滚动条 */
.chart-docs-container:not(:hover) {
    scrollbar-width: none; /* Firefox */
}

.chart-docs-container:not(:hover)::-webkit-scrollbar {
    width: 0px; /* Chrome, Safari, Edge: 完全隐藏 */
}

/* 深色模式下的图表文档样式 */
.dark-theme .modal-content {
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .modal-header {
    background: #374151;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .chart-docs-container {
    background: #1f2937;
}

.dark-theme .chart-docs-header {
    background: #374151;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .chart-type-icon {
    background: #4b5563;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.dark-theme .syntax-content pre {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border: 2px solid #4b5563;
    color: #f9fafb;
}

.dark-theme .syntax-content pre::before {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.dark-theme .parameter-item {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-theme .parameter-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dark-theme .parameter-code {
    background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
    color: #f472b6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dark-theme .example-code-container {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border: 2px solid #4b5563;
}

.dark-theme .example-code-container pre {
    background: transparent;
    color: #f9fafb;
}

.dark-theme .copy-example-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #4b5563;
    color: #9ca3af;
}

.dark-theme .copy-example-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.dark-theme .tip-item {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-left: 4px solid #3b82f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-theme .tip-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dark-theme .tip-icon {
    color: #60a5fa;
}

.dark-theme .tip-text {
    color: #bfdbfe;
}

.dark-theme .modal-footer {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .copy-example-btn {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

.dark-theme .copy-example-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.dark-theme .tip-item {
    background-color: #1e3a8a;
    border-left-color: #3b82f6;
}

.dark-theme .tip-icon {
    color: #60a5fa;
}

.dark-theme .tip-text {
    color: #93c5fd;
}

.btn-primary, .btn-secondary {
    padding: 8px 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    outline: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: black;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: var(--text-primary);
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
}

/* 深色主题下的模态框样式 */
body.dark-theme .modal-content {
    background-color: #2d2d2d;
    color: #e1e4e8;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme .theme-preview-container {
    border-color: #444;
}

body.dark-theme .close-btn {
    color: #999;
}

body.dark-theme .close-btn:hover {
    background-color: #3d3d3d;
    color: #e1e4e8;
}

body.dark-theme .color-input,
body.dark-theme .color-text {
    background-color: #3d3d3d;
    border-color: #555;
    color: #e1e4e8;
}

body.dark-theme .theme-preview-diagram {
    background-color: #3d3d3d;
}

body.dark-theme .btn-secondary {
    background-color: #3d3d3d;
    color: #e1e4e8;
    border-color: #555;
}

body.dark-theme .btn-secondary:hover {
    background-color: #4d4d4d;
}

/* 确保深色主题下面板操作按钮的悬停样式正确应用 */
body.dark-theme .panel-actions .action-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.nav-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 下拉选择框样式 */
.highlight-select {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.highlight-select:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 主题切换功能已删除 */

/* 主要内容区域 */
.editor-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    z-index: 1; /* 较低的层级，确保在头部之下 */
}

/* 代码面板 */
.code-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    transition: var(--transition);
    border-radius: 0;
}

/* 主题切换功能已删除 */

/* 预览面板 */
.preview-panel {
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
    transition: var(--transition);
}

/* 面板标题 */
.panel-header {
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 130px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px 3px 0 0;
}

/* 主题切换功能已删除 */

.panel-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 代码容器 */
.code-container {
    flex: 1;
    position: relative;
    overflow: auto; /* 只有在内容超出时才显示滚动条 */
}

/* 代码高亮层 */
.code-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    pointer-events: none;
    overflow: visible; /* 让高亮层跟随编辑器内容，不独立滚动 */
    color: transparent;
    background: transparent;
}

#mini-map-viewport {
    max-width: 100px;
    max-height: 100px;
}

/* 代码编辑器 */
.code-editor {
    position: relative;
    width: 100%;
    min-height: 100%;
    padding: 20px;
    margin: 0;
    border: none;
    outline: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: transparent;
    color: inherit;
    caret-color: #667eea;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden; /* 编辑器本身不显示滚动条，由容器控制 */
}

body.dark-theme .code-editor {
    caret-color: #5a67d8;
}

/* 预览容器 */
.preview-container {
    flex: 1;
    padding: 0px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: var(--background-color);
}

/* 预览控制区域 */
.preview-controls {
    position: absolute;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
}

/* 控制按钮组 */
.zoom-controls {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 深色主题下的控制按钮组 */
body.dark-theme .zoom-controls {
    background-color: rgba(30, 30, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* 统一控制按钮样式 - 现代设计 */
.control-btn {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: var(--text-primary);
    outline: none;
    margin: 0 2px;
    vertical-align: middle;
}

/* 按钮悬停效果 */
.control-btn:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
    border-color: transparent;
}

/* 按钮激活状态 - 仅适用于颜色和图案按钮 */
.control-btn:not(.zoom-btn).active {
    background-color: rgba(102, 126, 234, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 按钮点击效果 */
.control-btn:active {
    transform: translateY(0);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 缩放按钮样式 - 统一大小和样式 */
.zoom-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.zoom-btn:hover svg {
    transform: scale(1.1);
}

/* 颜色选择器包装器 */
.color-preview-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 现代颜色选择器样式 */
.color-picker {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: all 0.25s ease;
    background: none;
    padding: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.color-picker:hover {
    border-color: var(--primary-color);
    transform: scale(1.08);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 颜色按钮样式 - 统一为标准控制按钮 */
.bg-color-btn {
    width: 36px;
    height: 36px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-color-btn:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 图案按钮样式 - 统一尺寸 */
.pattern-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图案按钮激活状态样式 - 移除背景图案 */
.pattern-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 深色主题下的图案按钮激活状态 */
body.dark-theme .pattern-btn.active {
    background-color: rgba(102, 126, 234, 0.8);
    color: white;
    border-color: rgba(102, 126, 234, 1);
}

/* 图案预览元素的默认背景图案 */
.dots-preview {
    background-image: radial-gradient(var(--primary-color) 1px, transparent 1px);
    background-size: 8px 8px;
}

.lines-preview {
    /* 使用精确计算的背景大小确保斜线连续 */
    background-image: repeating-linear-gradient(45deg, var(--primary-color) 0, var(--primary-color) 1px, transparent 1px, transparent 7px);
    background-size: 10px 10px;
}

.grid-preview {
    background-image: 
        linear-gradient(var(--primary-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--primary-color) 1px, transparent 1px);
    background-size: 8px 8px;
}

/* 深色主题下的图案预览 */
body.dark-theme .dots-preview {
    background-image: radial-gradient(rgba(102, 126, 234, 0.5) 1px, transparent 1px);
}

body.dark-theme .lines-preview {
    /* 优化斜线连续性，使用精确计算的背景大小 */
    background-image: repeating-linear-gradient(
        45deg,
        rgba(102, 126, 234, 0.5),
        rgba(102, 126, 234, 0.5) 1px,
        transparent 1px,
        transparent 7px
    );
    background-size: 10px 10px;
}

body.dark-theme .grid-preview {
    background-image: 
        linear-gradient(rgba(102, 126, 234, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102, 126, 234, 0.5) 1px, transparent 1px);
}

/* 背景颜色类定义 - 修复预览窗口背景色设置异常 */
.bg-white {
    background-color: #ffffff;
}

.bg-light-gray {
    background-color: #f5f5f5;
}

.bg-gray {
    background-color: #e0e0e0;
}

.bg-black {
    background-color: #000000;
}

.bg-light-green {
    background-color: #f1f8e9;
}

/* 深色主题下的背景颜色适配 */
body.dark-theme .bg-white {
    background-color: #2d3748;
}

body.dark-theme .bg-light-gray {
    background-color: #2d3748;
}

body.dark-theme .bg-gray {
    background-color: #1a202c;
}

body.dark-theme .bg-black {
    background-color: #111827;
}

body.dark-theme .bg-light-green {
    background-color: #22543d;
}

/* 工具提示样式 */
.control-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    pointer-events: none;
    z-index: 1000;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.2s ease;
}

.control-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    margin-bottom: -8px;
    pointer-events: none;
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 深色主题下的工具提示 */
body.dark-theme .control-btn[title]:hover::after {
    background-color: rgba(30, 30, 46, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .control-btn[title]:hover::before {
    border-top-color: rgba(30, 30, 46, 0.9);
}

/* 背景图案样式定义 */
.bg-pattern-dots {
    background-image: radial-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.bg-pattern-lines {
    /* 优化斜线连续性实现 */
    background-image: repeating-linear-gradient(
        45deg,
        #eaeaeb,
        #f1f1f3 1px,
        transparent 1px,
        transparent 6px
    );
    background-size: 9px 9px; /* 对于6px间隔，45度角最佳大小为间隔×√2≈8.49px */
}

.bg-pattern-grid {
    background-image: linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* 图案预览图标样式 */
.pattern-preview {
    width: 20px;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 2px;
}

.pattern-dots-preview {
    background-image: radial-gradient(rgba(0, 0, 0, 0.3) 1px, transparent 1px);
    background-size: 6px 6px;
}

.pattern-lines-preview {
    background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0.3) 1px, transparent 1px, transparent 7px);
    background-size: 10px 10px;
}

.pattern-grid-preview {
    background-image: linear-gradient(rgba(0, 0, 0, 0.3) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(0, 0, 0, 0.3) 1px, transparent 1px);
    background-size: 6px 6px;
}

/* 图案选项按钮 */
.pattern-option {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.pattern-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.pattern-option.active {
    border-color: var(--primary-color);
    background-color: rgba(102, 126, 234, 0.1);
}

/* 图案预览 */
.pattern-preview {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background-color: white;
    border: 1px solid rgba(0,0,0,0.1);
}

/* 图案预览样式 */
.pattern-dots-preview {
    background-image: radial-gradient(circle, #666 2px, transparent 2px);
    background-size: 6px 6px;
}

.pattern-lines-preview {
    background-image: repeating-linear-gradient(45deg, #666 0, #666 1px, transparent 1px, transparent 6px);
}

.pattern-grid-preview {
    background-image: 
        linear-gradient(to right, #666 1px, transparent 1px),
        linear-gradient(to bottom, #666 1px, transparent 1px);
    background-size: 6px 6px;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 18px;
}

.zoom-btn:hover {
    background-color: var(--primary-light);
    color: white;
    transform: scale(1.05);
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* 图表预览包装器 */
.chart-preview-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
}

.chart-preview-wrapper.dragging {
    cursor: grabbing;
}

/* 导览小窗 */
.mini-map {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 270px; /* 原来的1.5倍 (180px * 1.5) */
    height: 180px; /* 原来的1.5倍 (120px * 1.5) */
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0; /* 移除圆角 */
    box-shadow: var(--shadow-md);
    z-index: 10;
    display: none; /* 默认隐藏，当图表超出范围时显示 */
    flex-direction: column;
    transition: all 0.3s ease;
    /* 内嵌到页面右上角的新样式 */
    margin: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mini-map:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.mini-map-header {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.03);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 12px 12px 0 0;
    text-align: center;
    letter-spacing: 0.5px;
    user-select: none;
}

.mini-map-content {
    flex: 1;
    padding: 6px;
    overflow: hidden;
    position: relative;
    background-color: var(--background-color);
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 优化内嵌样式 */
    border-top: 1px solid var(--border-color-light);
}

.mini-map-thumbnail {
    transition: all 0.2s ease;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
}

.mini-map-viewport {
    position: absolute;
    border: 2px solid rgba(66, 133, 244, 0.7); /* 半透明蓝色边框 */
    background-color: rgba(255, 255, 255, 0.3); /* 半透明白色背景 */
    cursor: move;
    transition: all 0.2s ease;
    box-shadow: none;
    border-radius: 0; /* 移除圆角 */
    /* 优化内嵌样式 */
    backdrop-filter: blur(2px);
    /* 调整小方块大小 */
    min-width: 20px;
    min-height: 20px;
    /* 确保小方块宽高不超过导览小窗的1/3 */
    max-width: 90px; /* 270px * 1/3 */
    max-height: 60px; /* 180px * 1/3 */
}

.mini-map-viewport:hover {
    background-color: rgba(102, 126, 234, 0.35);
    border-color: var(--primary-light);
    transform: scale(1.02);
    /* 优化悬停效果 */
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

/* 深色主题下的样式 */
body.dark-theme .zoom-btn {
    background-color: #2d2d2d;
    color: #e1e4e8;
}

body.dark-theme .zoom-btn:hover {
    background-color: #5a67d8;
}

body.dark-theme .mini-map {
    background-color: #2d2d2d;
    border-color: #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-theme .mini-map-header {
    background-color: rgba(255, 255, 255, 0.05);
    color: #e1e4e8;
    border-bottom-color: #444;
}

body.dark-theme .mini-map-content {
    border-top-color: #444;
    background-color: #1e1e1e;
}

body.dark-theme .mini-map-viewport {
    border-color: #5a67d8;
    background-color: rgba(90, 103, 216, 0.2);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* 图表预览区域 */
.chart-preview {
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    overflow: auto;
    background-color: #ffffff;
    transition: background-color 0.3s ease, background-image 0.3s ease;
    /* border-radius: var(--border-radius); */
    /* box-shadow: var(--shadow-md); */
    /* border: 1px solid var(--border-light); */
}

.chart-preview:hover {
    /* box-shadow: var(--shadow-lg); */
    /* border-color: var(--border-color); */
}

body.dark-theme .chart-preview {
    background-color: #2d2d2d;
    box-shadow: var(--shadow-lg);
    border-color: #444;
}

/* 分隔条 */
.resizer {
    width: 5px;
    background-color: var(--border-color);
    cursor: col-resize;
    transition: var(--transition);
    position: relative;
}

.resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 40px;
    background-color: transparent;
    transition: var(--transition);
    border-radius: 3px;
}

body.dark-theme .resizer {
    background-color: #444;
}

.resizer:hover {
    background-color: var(--primary-light);
}

.resizer:hover::before {
    background-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-light);
}

body.dark-theme .resizer:hover {
    background-color: var(--primary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
    transition: color 0.3s ease;
}

body.dark-theme .empty-state {
    color: #666;
}

.empty-state svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 加载状态 */
.loading-state {
    text-align: center;
    color: #667eea;
    padding: 40px;
}

/* 错误状态 */
.error-state {
    text-align: center;
    color: #e53e3e;
    padding: 40px;
    transition: color 0.3s ease;
}

body.dark-theme .error-state {
    color: #f56565;
}

.error-state svg {
    margin-bottom: 20px;
}

/* 返回按钮样式 - 右下角浮动 */
#back-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    padding: 12px 20px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

#back-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(90deg, var(--primary-light), var(--secondary-color));
}

#back-btn:active {
    transform: translateY(-1px);
}

body.dark-theme #back-btn {
    background: linear-gradient(90deg, #4338ca, #4f46e5);
    box-shadow: var(--shadow-lg);
}

body.dark-theme #back-btn:hover {
    background: linear-gradient(90deg, #4f46e5, #6366f1);
    box-shadow: var(--shadow-xl);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
        text-align: center;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }
    
    .theme-controls,
    .action-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .theme-btn, .action-btn {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }
    
    .editor-content {
        flex-direction: column;
    }
    
    .code-panel,
    .preview-panel {
        width: 100%;
        height: 50%;
    }
    
    .code-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    body.dark-theme .code-panel {
        border-bottom-color: #444;
    }
    
    .resizer {
        width: 100%;
        height: 5px;
        cursor: row-resize;
    }
    
    #back-btn {
        bottom: 16px;
        right: 16px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* 打印样式 */
@media print {
    .editor-header,
    .resizer,
    .navigation-bar,
    .code-panel {
        display: none;
    }
    
    .preview-panel {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        margin: 0;
        padding: 20px;
    }
    
    .chart-preview {
        box-shadow: none;
        background: white;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empty-state,
.loading-state,
.error-state {
    animation: fadeIn 0.3s ease-out;
}

/* Prism.js 主题覆盖 */
body.dark-theme .token.comment,
body.dark-theme .token.prolog,
body.dark-theme .token.doctype,
body.dark-theme .token.cdata {
    color: #6a9955;
}

body.dark-theme .token.punctuation {
    color: #d4d4d4;
}

body.dark-theme .token.property,
body.dark-theme .token.tag,
body.dark-theme .token.boolean,
body.dark-theme .token.number,
body.dark-theme .token.constant,
body.dark-theme .token.symbol,
body.dark-theme .token.deleted {
    color: #b5cea8;
}

body.dark-theme .token.selector,
body.dark-theme .token.attr-name,
body.dark-theme .token.string,
body.dark-theme .token.char,
body.dark-theme .token.builtin,
body.dark-theme .token.inserted {
    color: #ce9178;
}

body.dark-theme .token.operator,
body.dark-theme .token.entity,
body.dark-theme .token.url,
body.dark-theme .language-css .token.string,
body.dark-theme .style .token.string {
    color: #d4d4d4;
}

body.dark-theme .token.atrule,
body.dark-theme .token.attr-value,
body.dark-theme .token.keyword {
    color: #569cd6;
}

body.dark-theme .token.function,
body.dark-theme .token.class-name {
    color: #dcdcaa;
}

body.dark-theme .token.regex,
body.dark-theme .token.important,
body.dark-theme .token.variable {
    color: #d16969;
}